#ifndef RENDER_STATE
#define RENDER_STATE

namespace gengine
{
	namespace kernel
	{
class RenderState
{
public:
	//RenderState(){}
	virtual ~RenderState(){}
	/*enum RenderStateTypes
	{
	};*/

	enum SrcBlend
	{
		SB_ZERO,
		SB_ONE,
		SB_DST_COLOR,
		SB_ONE_MINUS_DST_COLOR,
		SB_SRC_ALPHA,
		SB_ONE_MINUS_SRC_ALPHA,
		SB_DST_ALPHA,
		SB_ONE_MINUS_DST_ALPHA,
		SB_SRC_ALPHA_SATURATE,
		SB_CONSTANT_COLOR,
		SB_ONE_MINUS_CONSTANT_COLOR,
		SB_CONSTANT_ALPHA,
		SB_ONE_MINUS_CONSTANT_ALPHA,
		SB_QUANTITY
	};

	enum BlendingValues
	{
		BV_ZERO,
		BV_ONE,
		BV_SRC_COLOR,
		BV_ONE_MINUS_SRC_COLOR,
		BV_SRC_ALPHA,
		BV_ONE_MINUS_SRC_ALPHA,
		BV_DST_ALPHA,
		BV_ONE_MINUS_DST_ALPHA,
		BV_CONSTANT_COLOR,
		BV_ONE_MINUS_CONSTANT_COLOR,
		BV_CONSTANT_ALPHA,
		BV_ONE_MINUS_CONSTANT_ALPHA,
		BV_QUANTITY
	};

	enum AlphaTest
	{
		AT_NEVER,
		AT_LESS,
		AT_EQUAL,
		AT_LEQUAL,
		AT_GREATER,
		AT_NOTEQUAL,
		AT_GEQUAL,
		AT_ALWAYS,
		AT_QUANTITY
	};

	enum FrontType
	{
		FT_CCW, // front faces are counterclockwise ordered
		FT_CW, // front faces are clockwise ordered
		FT_QUANTITY
	};

	enum  CullType
	{
	CT_FRONT, // cull fr
	CT_BACK, // cull ba
	CT_QUANTITY
	};
protected:
	bool lighting;
	bool blending;
	bool depthTest;
	bool stensilTest;
	bool alphaTest;
	bool depthWrites;
	

	int stensilFunc;
	int stensilRef;
	unsigned stensilMask;
	
	int stensilOp;
	int stensilOpZ;
	int stensilOpZpass;
	unsigned stensilWriteMask;
	
	bool culling;
	int cullFace;
	int frontFace;
	int polygonModeFront;
	int polygonModeBack;

public:
	
	virtual bool EnableLighting        (bool enable) =  0;
	virtual bool EnableDephtTest       (bool enable) =  0;
	virtual bool EnableAlphaTest       (bool enable) =  0;
	virtual bool EnableBlending        (bool enable) =  0;
	virtual bool EnableStensilTest     (bool enable) =  0;
	virtual bool EnableCulling         (bool enable) =  0;
	virtual bool EnableDepthWrites     (bool enabled) = 0;
	virtual void BindTextureUnit       (int target,int id) = 0;
	virtual void UnbindTextureUnit     (int target) = 0;
	
	virtual bool SetCullFace            (int mode)    = 0;
	virtual bool SetFrontFace           (int mode)    = 0;
	virtual bool SetPolygonModeFront    (int mode)    = 0;
	virtual bool SetPolygonModeBack     (int mode)    = 0; 

	virtual bool SetDepthFunc           (unsigned func)             = 0;
	virtual	bool SetAlphaFunc           (int alphaFunc, float ref ) = 0;
	virtual bool SetBlendFunc           (int srcFunc, int dstFunc)  = 0;
	
	virtual bool SetStencilFunc         (int func, int ref, unsigned mask) = 0;
	virtual bool SetStencilOp           (int fail, int zfail, int zpass) = 0;
	virtual bool SetStencilWrites       (unsigned mask) = 0;
};
extern RenderState * GlobalRendererState ;
}
}
#endif